﻿using System;
using System.Collections.Generic;
using System.Text;

namespace Vara.Location
{
    public class Location : ILocation
    {
        private readonly int _id = 0;
        private string _name = string.Empty;
        private string _address1 = string.Empty;
        private string _address2 = string.Empty;
        private string _address3 = string.Empty;
        private string _postcode = string.Empty;
        private string _AdditionalField1 = string.Empty;
        private string _AdditionalField2 = string.Empty;

        public Location()
        {

        }

        public Location(int id)
        {
            _id = id;
        }

        public virtual int ID
        {
            get
            {
                return _id;
            }
        }

        public virtual string Name
        {
            get
            {
                return _name;
            }
            set
            {
                _name = value;
            }
        }


        public virtual bool IsInternal
        {
            get { return !string.IsNullOrEmpty(this.AdditionalField2.Trim()); }
        }


        public virtual string Address1
        {
            get
            {
                return _address1;
            }
            set
            {
                _address1 = value;
            }
        }

        public virtual string Address2
        {
            get
            {
                return _address2;
            }
            set
            {
                _address2 = value;
            }
        }

        public virtual string Address3
        {
            get
            {
                return _address3;
            }
            set
            {
                _address3 = value;
            }
        }

        public virtual string Postcode
        {
            get
            {
                return _postcode;
            }
            set
            {
                _postcode = value;
            }
        }
        public virtual string AdditionalField1
        {
            get
            {
                return _AdditionalField1;
            }
            set
            {
                _AdditionalField1 = value;
            }
        }
        public virtual string AdditionalField2
        {
            get
            {
                return _AdditionalField2;
            }
            set
            {
                _AdditionalField2 = value;
            }
        }
        public override string ToString()
        {
            return this.Name + (string.IsNullOrEmpty(this.AdditionalField2) ? "" : (" - "+this.AdditionalField2));
        }
    }

    public class InternalLocation : Location,ILocation
    {
        public InternalLocation()
        {

        }

        public InternalLocation(int id): base(id)
        {

        }
    }
    public class ExternalLocation : Location, ILocation
    {
        public ExternalLocation()
        {

        }

        public ExternalLocation(int id) : base(id)
        {

        } 
    }

}
